using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Clue_Less_Client.localhost;

namespace Clue_Less_Client
{
    public partial class SuggestionLog : Form
    {
        private int _gameID;

        public SuggestionLog(int gameID)
        {
            _gameID = gameID;
            InitializeComponent();
        }

        private void SuggestionLog_Load(object sender, EventArgs e)
        {
            _refresh();
        }

        private void _refresh()
        {
            MainService ws = new MainService();
            List<Suggestion> suggestions = new List<Suggestion>(ws.GetSuggestions(_gameID));
            dgLog.Rows.Clear();
            foreach (Suggestion s in suggestions)
            {
                dgLog.Rows.Add(new string[] {s.PlayerName, s.DisproverName, s.SuspectRoom.Name,
                    s.SuspectWeapon.Name, s.SuspectCharacter.Name});
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            _refresh();
        }
    }
}